/***
 * @file DoubleExp.cpp
 *
 *  @Author: calle
 *  @date May 1, 2011
 *  
 *  @brief
 *  	
 */

#include "DoubleExp.h"
#include <Interfaces/IExpVisitor.h>
#include <RandomPkg/Randomizer.h>
#include <iosfwd>
#include <sstream>




DoubleExp::DoubleExp( double d ):
m_terminal(d)
{


}

DoubleExp::~DoubleExp() {

}

void DoubleExp::setValue(double d)
{
	m_terminal=d;
}

double DoubleExp::getValue() const
{
	return m_terminal;
}

void DoubleExp::accept(IExpVisitor *v)
{
	v->VisitDoubleExp(this);

}

IExp *DoubleExp::clone() const
{
	return new DoubleExp(m_terminal);


}

AbsSyn::IExpPtr DoubleExp::genreateDblExp()
{
	RandomPkg::Randomizer rndGen;
	double dblVal=rndGen.createRandom(0.0,10000.0);
	AbsSyn::IExpPtr ptr(new DoubleExp(dblVal));
	return ptr;
}



bool DoubleExp::operator==( const DoubleExp& rhs)
{
	bool ret = false;
	if( getValue() == rhs.getValue() )
	{
		ret = true;
	}

	return ret;

}

bool DoubleExp::operator!=( const DoubleExp& rhs)
{
	return !((*this) == rhs);
}


std::string DoubleExp::toString() const
{
	std::ostringstream sstream;
	sstream << m_terminal;
	return sstream.str();
}



